<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
    <link href="res/style.css" rel="stylesheet">
    <script src="http://47.106.66.89:8080/js/vue.min.js"></script>
    <script src="http://47.106.66.89:8080/js/axios.min.js"></script>
</head>
<body>
<div id="app" class="flex">
    <<main>
        <header class="flex">
            <div>
                <h3>源辰银行</h3>
                <small>ycinfo bank</small>
            </div>
            <div id="contact">
                <div>客服电话: 8888</div>
                <div>网址: www.ycinfo.bank.com</div>
            </div>
        </header>
        <div class="msg">
            倒计时: <h2>32</h2> 秒
        </div>
        <div id="pane" class="flex">
            <div class="btns">
                <a class="hidden">占位</a>
                <a class="hidden">占位</a>
                <a class="hidden">占位</a>
            </div>
            <div id="info">
                <h2>查询服务</h2>
                <form action="main.html">
                    <table>
                        <tr><th>序号</th><th>时间</th><th>交易金额</th><th>交易费</th><th>备注</th></tr>
                        <tr v-for="(item,index) in records"><td>{{index+1}}</td><td>{{item.optime}}</td><td>{{item.opmoney}}</td><td>{{item.charge}}</td><td>{{item.remark}}</td></tr>
                    </table>
                    <div id="page" class="right">
                        <a  @click="change(-1)">上一页</a> {{page}}/{{total}}<a  @click="change(1)">下一页</a>
                    </div>
                </form>
            </div>
            <div class="btns">
                <a class="hidden">占位</a>
                <a class="hidden">占位</a>
                <a class="hidden">占位</a>
                <a href="main.html" class="right">返回</a>
            </div>
        </div>
    </main>>
</div>
<script>
    let app = new Vue({
        el:"#app",
        data: {
            page:1,
            total:1,
            records:[]
        },
        methods:{
            change(num){
                this.page+=num;
                if (this.page<=1){
                    this.page = 1;
                }else if(this.page>=this.total){
                    this.page=this.total
                }
                this.query();
            },
            query(){
                axios.get(
                    "record/queryRecord",
                    {
                        params:{
                            page: this.page
                        }
                    }
                ).then(resp=>{
                    if(resp.data){
                        this.records = resp.data;
                        this.total = Math.ceil(this.records[0].num/5);
                        console.log(this.records)
                    }else {
                        alert("错误");
                    }
                });
            }
        },
        created(){
            this.query();
        }
    });
</script>
</body>
</html>
